<!--{template common/header}-->
<!--{if !$_GET['infloat']}-->
<header class="header">
    <div class="nav">
        <a href="javascript:;" onclick="history.go(-1)" class="z"><img src="{STATICURL}image/mobile/images/icon_back.png" /></a>
		<span>{lang dzapp_base:bind}</span>
    </div>
</header>
<!--{/if}-->
<style type="text/css">
.tb{margin-top:10px;padding-left:10px;line-height:30px;border-bottom:1px solid #CDCDCD;}
.tb li{float:left;margin:0 3px -1px 0;}
.ie6 .tb .a,.ie6 .tb .current{position:relative;}
.tb a{display:block;padding:0 10px;border:1px solid #CDCDCD;background:#E5EDF2;border-radius: 10px 10px 0 0;}
.tb .a a,.tb .current a{border-bottom-color:#f3f3f3;background:transparent;font-weight:700;}
.tb a:hover{text-decoration:none;}
.welcome { margin: 10px; }
.loginbox, .registerbox { padding: 0; }
#codeli{
	display:inline-block;
	width:50%;
}
#codeli input{
	display:inline-block;
	width:50%;
}
#codebtn{
	display: inline-block;
	width: 40%;
	border: none;
	background: none;
	border: 1px solid #E8E8E8;
	border-bottom: 1px solid #DDD;
	line-height: 45px;
	padding: 0 auto;
	color: #FFF;
	font-size: 14px;
	margin-left:3px;
	float:right;
	background: #FF8300;
}
</style>
<div class="welcome">
		<strong class="xs2">Hi, $this->dzapp_account[2],</strong>
		<span class="xg2">{lang dzapp_base:welcome_connect}$_G[setting][bbname]</span>
</div>
<ul class="tb cl">
	<li id="bind_1" onclick="switch_bind(1)" class="a"><a href="javascript:;">{lang dzapp_base:new_account}</a></li>
	<li id="bind_2" onclick="switch_bind(2)"><a href="javascript:;">{lang dzapp_base:old_account}</a></li>
</ul>
<div class="loginbox registerbox">
	<form method="post" autocomplete="off" name="register" id="registerform" action="plugin.php?id=dzapp_base&mod=bind&mobile=2">
	<div class="login_from">
		<input type="hidden" name="regsubmit" value="yes" />
		<input type="hidden" name="formhash" value="{FORMHASH}" />
		<!--{eval $dreferer = str_replace('&amp;', '&', dreferer());}-->
		<input type="hidden" name="referer" value="$dreferer" />
		<input type="hidden" name="activationauth" value="{if $_GET[action] == 'activation'}$activationauth{/if}" />
		<input type="hidden" name="agreebbrule" value="$bbrulehash" id="agreebbrule" checked="checked" />
		<ul>
			<!--{if $_G[cache][plugin][dzapp_mobile]}-->
			<li>
				<input type="text" id="mobile" name="mobile" tabindex="1" class="px p_fre" size="30" autocomplete="off" value="" placeholder="{lang dzapp_base:mobile}" fwin="login">
			</li>
			<li id="codeli">
				<input type="text" id="code" name="code" tabindex="1" class="px p_fre" size="6" autocomplete="off" value="" placeholder="{lang dzapp_base:code}" fwin="login">
			</li>
			<button type="button" id="codebtn">{lang dzapp_base:get_code}</button>
			<!--{/if}-->
			<!--{if !$_G[cache][plugin][dzapp_mobile][username]}-->
			<li><input type="text" tabindex="1" class="px p_fre" size="30" autocomplete="off" value="" name="{$_G['setting']['reginput']['username']}" placeholder="{lang registerinputtip}" fwin="login"></li><!--{/if}-->
			<li><input type="password" tabindex="2" class="px p_fre" size="30" value="" name="{$_G['setting']['reginput']['password']}" placeholder="{lang login_password}" fwin="login"></li>
			<li><input type="password" tabindex="3" class="px p_fre" size="30" value="" name="{$_G['setting']['reginput']['password2']}" placeholder="{lang registerpassword2}" fwin="login"></li>
			<!--{if !$_G[cache][plugin][dzapp_mobile][email]}-->
			<li class="bl_none"><input type="email" tabindex="4" class="px p_fre" size="30" autocomplete="off" value="" name="{$_G['setting']['reginput']['email']}" placeholder="{lang registeremail}" fwin="login"></li><!--{/if}-->
			<!--{if empty($invite) && ($_G['setting']['regstatus'] == 2 || $_G['setting']['regstatus'] == 3)}-->
				<li><input type="text" name="invitecode" autocomplete="off" tabindex="5" class="px p_fre" size="30" value="" placeholder="{lang dzapp_base:invite_code}" fwin="login"></li>
			<!--{/if}-->
			<!--{if $_G['setting']['regverify'] == 2}-->
				<li><input type="text" name="regmessage" autocomplete="off" tabindex="6" class="px p_fre" size="30" value="" placeholder="{lang register_message}" fwin="login"></li>
			<!--{/if}-->
		</ul>
		<!--{if $secqaacheck || $seccodecheck}-->
			<!--{subtemplate common/seccheck}-->
		<!--{/if}-->
	</div>
	<div class="btn_register"><button tabindex="7" value="true" name="regsubmit" type="submit" class="formdialog pn pnc"><span>{lang dzapp_base:register_to_bind}</span></button></div>
	</form>
</div>
{eval $loginhash = 'L'.random(4);}
<div class="loginbox <!--{if $_GET[infloat]}-->login_pop<!--{/if}-->">
		<form id="loginform" method="post" action="plugin.php?id=dzapp_base&mod=bind&action=login&loginsubmit=yes&loginhash=$loginhash&mobile=2" onsubmit="{if $_G['setting']['pwdsafety']}pwmd5('password3_$loginhash');{/if}" style="display: none">
		<input type="hidden" name="formhash" id="formhash" value='{FORMHASH}' />
		<input type="hidden" name="referer" id="referer" value="<!--{if dreferer()}-->{echo dreferer()}<!--{else}-->forum.php?mobile=2<!--{/if}-->" />
		<input type="hidden" name="fastloginfield" value="username">
		<input type="hidden" name="cookietime" value="2592000">
	<div class="login_from">
		<ul>
			<li><input type="text" value="" tabindex="1" class="px p_fre" size="30" autocomplete="off" value="" name="username" placeholder="{lang inputyourname}" fwin="login"></li>
			<li><input type="password" tabindex="2" class="px p_fre" size="30" value="" name="password" placeholder="{lang login_password}" fwin="login"></li>
			<li class="bl_none questionli">
				<div class="login_select">
				<span class="login-btn-inner">
					<span class="login-btn-text">
						<span class="span_question">{lang security_question}</span>
					</span>
					<span class="icon-arrow">&nbsp;</span>
				</span>
				<select id="questionid_{$loginhash}" name="questionid" class="sel_list">
					<option value="0" selected="selected">{lang security_question}</option>
					<option value="1">{lang security_question_1}</option>
					<option value="2">{lang security_question_2}</option>
					<option value="3">{lang security_question_3}</option>
					<option value="4">{lang security_question_4}</option>
					<option value="5">{lang security_question_5}</option>
					<option value="6">{lang security_question_6}</option>
					<option value="7">{lang security_question_7}</option>
				</select>
				</div>
			</li>
			<li class="bl_none answerli" style="display:none;"><input type="text" name="answer" id="answer_{$loginhash}" class="px p_fre" size="30" placeholder="{lang security_a}"></li>
		</ul>
		<!--{if $secqaacheck || $seccodecheck}-->
		<!--{subtemplate common/seccheck}-->
		<!--{/if}-->
	</div>
	<div class="btn_login"><button tabindex="3" value="true" name="submit" type="submit" class="formdialog pn pnc"><span>{lang dzapp_base:login_to_bind}</span></button></div>
	</form>
</div>
<!--{if $_G['setting']['pwdsafety']}-->
	<script type="text/javascript" src="{$_G['setting']['jspath']}md5.js?{VERHASH}" reload="1"></script>
<!--{/if}-->
<!--{eval updatesession();}-->
<script type="text/javascript">
	(function() {
		$(document).on('change', '.sel_list', function() {
			var obj = $(this);
			$('.span_question').text(obj.find('option:selected').text());
			if(obj.val() == 0) {
				$('.answerli').css('display', 'none');
				$('.questionli').addClass('bl_none');
			} else {
				$('.answerli').css('display', 'block');
				$('.questionli').removeClass('bl_none');
			}
		});
		formdialog.init();
	 })();

function switch_bind(type) {
	if(type == 1) {
		document.getElementById('bind_1').className = 'a';document.getElementById('bind_2').className = '';
		document.getElementById('registerform').style.display = '';document.getElementById('loginform').style.display = 'none';
	} else {
		document.getElementById('bind_1').className = '';document.getElementById('bind_2').className = 'a';
		document.getElementById('registerform').style.display = 'none';document.getElementById('loginform').style.display = '';
	}
}


var interval = 60;

$('#codebtn').on('click', function() {
	$.ajax({
		type : 'GET',
		url : 'plugin.php?id=dzapp_mobile&mod=ajax&ac=code&type=bind&inajax=1&formhash={FORMHASH}',
		data : { mobile: $('#mobile').val() },
		dataType : 'text',
		success : function(s) {
			if(s == 'success') {
				$('#codebtn').attr('disabled', 'true');
				$('#codebtn').css('background', '#CCC');
				tmr_code();
			} else {
				alert(s);
			}
		}
	})
});
function tmr_code() {
	$('#codebtn').html(interval + 's{lang dzapp_base:reget}');
	interval --;
	if(interval > 0) {
		setTimeout('tmr_code()', 1000);
	} else {
		$('#codebtn').html('{lang dzapp_base:reget}');
		$('#codebtn').removeAttr("disabled"); 
		$('#codebtn').css('background', '#FF8300');
		interval = 60;
	}
}
</script>
<!--{template common/footer}-->
